package com.dao;

import com.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.Map;

public interface OrderDao {
    /*新增预约订单*/
    void addOrder(Order order);
    /*查询是否存在了*/
    @Select("select count(1) from t_order where member_id=#{mid} and orderDate=#{date}" )
    int findCount(@Param("mid") Integer mid, @Param("date") Date date);
    //体检人,体检套餐,体检日期,预约类型
    @Select("SELECT m.`name` member,s.`name` setmeal,o.`orderDate`,o.`orderType` FROM t_order o ,t_setmeal s ,t_member m WHERE o.`id`=#{id} AND o.`setmeal_id`=s.`id` AND o.`member_id`=m.`id`")
    Map<String,Object> findById(int id);
    //今日预约
    @Select("select count(id) from t_order where orderDate = #{value}")
    int todayOrder(String date);
    //今日到诊数
    @Select("select count(id) from t_order where orderDate = #{value} and orderStatus = '已到诊'")
    int todayVisits(String date);
    //本周预约数
    @Select("select count(id) from t_order where orderDate >= #{value}")
    int thisWeekOrder(String s);
    @Select("select count(id) from t_order where orderDate >= #{value} and orderStatus = '已到诊'")
    int thisWeekVisits(String s);
}
